import {getProject} from '../../api/shuzhiCompare'
const strcompare = {
  state :{
    // collapsed : false,
    projects:[],
    selectedTaskId:0,
    tempTaskFlag:false,
    tempTaskNo:''
  },

  mutations: {
    /* setCollapsed (state) {
       return state.collapsed = !state.collapsed;
     },*/
    // setWorkers(state,data){
    //   state.workers = data;
    // },
    setProjects(state,data){
      state.projects = data
    },
    flushProjects(state){
        getProject().then(res=>{
          state.projects = res.data()
        }).catch(err=>{
          console.log("获取目录失败")
          console.log(err)
        })
    },
    setSelectedTaskId(state,data){
      state.selectedTaskId = data
    },
    setTempTaskFlag(state,data){
      state.tempTaskFlag = data
    },
    setTempTaskNo(state,data){
      state.tempTaskNo = data
    }


  },
  actions: {
    /*setCollapsed ({ commit }) {
      commit("setCollapsed");
    }*/
    // setWorkers({commit}){
    //   commit('setWorkers',data)
    // }
    setProjects({commit},data){
      commit('setProjects',data)
    },
    flushProjects({commit}){
      commit('flushProjects')
    },

    setSelectedTaskId({commit},data){
      commit('setSelectedTaskId',data)
    },
    setTempTaskFlag({commit},data){

      commit('setTempTaskFlag',data)
    },
    setTempTaskNo({commit},data){
      commit('setTempTaskNo',data)
    }


  }


}
export default strcompare;
